package com.example.beikeyigou.f_page;

import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

import androidx.viewpager.widget.PagerAdapter;

import java.util.List;

public class FPTypeVPAdapter extends PagerAdapter {
    List<GridView> viewList;
    public FPTypeVPAdapter(List<GridView> viewList) {
        this.viewList = viewList;
        Log.i("lsh", "FPTypeVPAdapter: viewlist==="+ viewList.size());
    }
    @Override
    public int getCount() {
        return viewList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        GridView view = viewList.get(position);
        container.addView(view);
        return view;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        GridView view = viewList.get(position);
        container.removeView(view);
    }
}
